/**
 * 
 */
package infocluster.prototype;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;

/**
 * @author 08302010017 Xi Qi
 *
 */
public abstract class GenericExcelProcessTask{

	private ArrayList<File> src = new ArrayList<File>();
	private ArrayList<File> dest = new ArrayList<File>();
	
	public boolean addSource(String src) throws FileNotFoundException{
		
		File tempSource = new File(src);
		if(tempSource.exists()){
			this.src.add(tempSource);
			return true;
		}
		
		throw new FileNotFoundException();
	}
	
	public File getSource(int index) throws ArrayIndexOutOfBoundsException{
		if(index >= this.src.size()){
			throw new ArrayIndexOutOfBoundsException();
		}
		
		return this.src.get(index);
	}
	
	public boolean addDest(String dest){
		File tempDest = new File(dest);
		this.dest.add(tempDest);
		return true;
	}
	
	public File getDest(int index){
		if(index >= this.dest.size()){
			throw new ArrayIndexOutOfBoundsException();
		}
		
		return this.dest.get(index);
	}
	
	public boolean reset(){
		this.src.clear();
		this.dest.clear();
		return true;
	}

}
